-
Notifications
You must be signed in to change notification settings - Fork 125
[DRAFT] Migrate from using readline to prompt-toolkit #1553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Tons of tests failing and some even getting stuck.
…f the correct arguments to app.complete() This fixes all of the test_argparse_comleter.py tests. There are still failing tests in test_cmd2.py, test_history.py, and test_run_pyscript.py as well as a test in test_cmd2.py that gets stuck.
TODO: - prompt-toolkit history isn't properly initialized with history from a persistent history file, as shown by the remaining failing history test
… of mocking the built-in input function. There are still 3 failing and 1 skipped test in test_cmd2.py Additionally, some tests in test_run_pyscript.py are getting stuck.All tests in other files are passing.
…ork with prompt-toolkit
Also: - Fixed make clean so it cleans up code coverage file artifacts
Also added a bottom toolboar for displaying these type hints.
|
🤖 Hi @tleonhardt, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1553 +/- ##
==========================================
+ Coverage 98.94% 99.11% +0.16%
==========================================
Files 21 21
Lines 4942 4845 -97
==========================================
- Hits 4890 4802 -88
+ Misses 52 43 -9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
🤖 I'm sorry @tleonhardt, but I was unable to process your request. Please see the logs for more details. |
… PromptSession and ensuring consistent input/output usage
…rs for better compatibility
…ws runners for better compatibility" This reverts commit 59c5ffa.
…ializing PromptSession and ensuring consistent input/output usage" This reverts commit c263b38.
…tializing PromptSession and ensuring consistent input/output usage" This reverts commit f194db6.
…_complete_statement
Fixed an issue where prompt_toolkit history was not being cleared/updated when cmd2 history changed. Restored consecutive deduplication logic in history. Improved completion word detection to use correct delimiters matching cmd2 logic.
This WIP/Draft PR migrates from using GNU Readline for user input, tab-completion, and history to using prompt-toolkit for the same purpose.
prompt-toolkitis a pure-Pythonreadlinereplacement that is fully cross-platform compatible and doesn't rely on the presence of underlying C dynamic libraries. It also opens the door to some advanced features in the future.All use of
readlineis removed and thecmd2.rl_utilsmodule has been deleted. There is a newcmd2.pt_utilsmodule in its place. Currently all linting is passing and the documentation builds. This is an early draft and there is likely a bunch of things that need to be considered related to asynicio support, signal handlers, and blocking popen calls. There also should likely be some code cleanup and perhaps some refactoring. But this is at the working prototype stage that can be tweaked.All tests are passing on Linux and macOS. On Windows there are many test failures and I suspect it is related to the particular Windows test setup in GitHub Actions and how prompt-toolkit interacts with it. But I don't have a Windows VM to test on currently.
TODO: